﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace BusinessObject
{
    public class MonteCarloSimulationBO<T>
    {
        #region Singleton

        private static readonly MonteCarloSimulationBO<T> _instance = new MonteCarloSimulationBO<T>();

        /// <summary>
        /// Instância do objeto singleton.
        /// </summary>
        public static MonteCarloSimulationBO<T> Instance
        {
            get { return _instance; }
        }

        private MonteCarloSimulationBO() { }

        #endregion Singleton

        public IList<int> monteCarloSimulation(int iterations, IList<T> projectItens)
        {
            IList<int> resultado = null;
            switch (projectItens.FirstOrDefault().GetType().Name)
            {
                case "Epic":
                    resultado = MonteCarloAlgorithm.MonteCarloSimulation.monteCarloInt(iterations, (IList<Epic>)projectItens);
                    break;
                case "History":
                    resultado = MonteCarloAlgorithm.MonteCarloSimulation.monteCarloInt(iterations, (IList<History>)projectItens);
                    break;

                case "Task":
                    resultado = MonteCarloAlgorithm.MonteCarloSimulation.monteCarloInt(iterations, (IList<Task>)projectItens);
                    break;

                default:
                    break;

            }
            return resultado;
        }
    }
}
